package com.atguigu.springcloud.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import com.atguigu.springcloud.entity.CommonResult;
import com.atguigu.springcloud.entity.Payment;

/**
 *  Feign 相当于 RestTemplate 的封装，同时自带 ribbon 的负债均衡
 *  默认超时时间为1秒钟 ,如果当前调用服务超时，将切换到其他ke用的服务
 *  如果需要设置Feign客户端超时时间 参见：ribbon. ReadTimeout: 5000 和 ribbon.ConnectTimeout: 5000
 * @author heh
 * @date 2020-04-05
 */
@Component
//被调用者的 spring.application.name
@FeignClient("CLOUD-PAYMENT-SERVICE")
public interface PaymentService  {
	//被调用者 url
	@GetMapping(value = "/payment/get/{id}")
	public CommonResult getById(@PathVariable("id") long id);

	@GetMapping(value = "/payment/info")
	public CommonResult info();
}
